package com.fang.security.common.exception;

import com.fang.security.common.base.ResultCode;
import lombok.Data;

/**
 * @Description
 * @Author Bernie
 * @Date 2024/4/10 16:31
 **/
@Data
public class RException extends Exception{
    private static final long serialVersionUID = 1L;

    private String message;
    private String code;

    public RException(String msg) {
        super(msg);
        this.message = msg;
    }

    public RException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
    }

    public RException(String msg, String code) {
        super(msg);
        this.message = msg;
        this.code = code;
    }

    public RException(String msg, Throwable e) {
        super(msg, e);
        this.message = msg;
    }

    public RException(String msg, String code, Throwable e) {
        super(msg, e);
        this.message = msg;
        this.code = code;
    }

}

